﻿using MvcApplication.Common;
using MvcApplication.CommonWebApi.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MvcApplication.CommonWebApi
{
    public class ScriptCollection
    {
        public static string GetCommandText(string key)
        {
            return CommonWebApiScriptLoader.Scripts.FirstOrDefault(t => t.CommonId == key).Text;
        }

        public Script Get(string key)
        {
            return CommonWebApiScriptLoader.Scripts.FirstOrDefault(t => t.CommonId == key);
        }

        public List<Script> GetAll()
        {
            return CommonWebApiScriptLoader.Scripts;
        }

        public int Count
        {
            get { return CommonWebApiScriptLoader.Scripts.Count; }
        }
    }
}
